package edu.spec.pms.model.sys;
import edu.spec.pms.model.anno.Excel;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name="t_user", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_name"})})
public class User {

	private int id;
	private Date createDate;
	private Date updateDate;
	private int accountExpired;
	private int accountLocked;
	private int credentialsExpired;
	private int status;
	private String des;
	private String password;
	@Excel(exportName="姓名",exportFieldWidth=20,exportConvertSign=0,importConvertSign=0)
	private String realName;
	@Excel(exportName="教工号",exportFieldWidth=20,exportConvertSign=0,importConvertSign=0)
	private String username;
	private User owner;
//	private String authorName;
	private Org org;

	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "create_date")
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Column(name = "update_date")
	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	@Column(name = "account_expired")
	public int getAccountExpired() {
		return accountExpired;
	}

	public void setAccountExpired(int accountExpired) {
		this.accountExpired = accountExpired;
	}

	@Column(name = "account_locked")
	public int getAccountLocked() {
		return accountLocked;
	}

	public void setAccountLocked(int accountLocked) {
		this.accountLocked = accountLocked;
	}

	@Column(name = "credentials_expired")
	public int getCredentialsExpired() {
		return credentialsExpired;
	}

	public void setCredentialsExpired(int credentialsExpired) {
		this.credentialsExpired = credentialsExpired;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	@Column(name = "des")
	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	@Column(name = "password")
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "real_name")
	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	@Column(name = "user_name")
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@ManyToOne
	@JoinColumn(name = "owner_id")
	public User getOwner() {
		return owner;
	}

	public void setOwner(User owner) {
		this.owner = owner;
	}

//	@Column(name = "author_name")
//	public String getAuthorName() {
//		return authorName;
//	}
//
//	public void setAuthorName(String authorName) {
//		this.authorName = authorName;
//	}

	@ManyToOne
	@JoinColumn(name = "org_id")
	public Org getOrg() {
		return org;
	}

	public void setOrg(Org org) {
		this.org = org;
	}

	public User() {
	}
}
